﻿<%@ Page Language="C#" MasterPageFile="~/Management.master" AutoEventWireup="true" CodeFile="sparepartView.aspx.cs" Inherits="sparepartView" Title="CMMS" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc2" %>

<%@ Register Assembly="EclipseWebSolutions.DatePicker" Namespace="EclipseWebSolutions.DatePicker"
    TagPrefix="ews" %>
<%@ Register assembly="StrengthControls.Scrolling" namespace="StrengthControls.Scrolling" tagprefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="m_contentBody" Runat="Server">

    <body  onload ="TabbedPanels1.showPanel(<%=GetTabIndex()%>)">
         <asp:TextBox ID="txtHiddenEquipmentId" runat="server" Width="77px" 
            Visible="False"></asp:TextBox>                          
    <div id="containerright" class="containerright">
          <div id="TabbedPanels1" class="TabbedPanels">
                <ul class="TabbedPanelsTabGroup">
                  <li class="TabbedPanelsTab" tabindex="0">List spareparts</li>
                  <li class="TabbedPanelsTab" tabindex="1">Detail Information </li>
                  <li class="TabbedPanelsTab" tabindex="2">Available spareparts </li>
                </ul>
          <div class="TabbedPanelsContentGroup">

                  <div class="TabbedPanelsContent">
                  
             
              
<table  class="GridItem" cellspacing="2"  cellpadding="2" style="width:auto; height:350px">
<tr><td align="center" class="BigLabel" >
       
         <asp:Label ID="lblTotalEquipment" runat="server" Text="Label"></asp:Label> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
         <asp:Label ID="lblMessageValidate" runat="server" CssClass="permissionstyle"></asp:Label>
        </td></tr>
 <tr>
         <td  align="center" class="GridItem"  style="text-align:center">
             <asp:GridView ID="grdGroupeSoftware1" runat="server" AllowPaging="True" Width="750px" 
                     AutoGenerateColumns="False"  Visible ="False" DataSourceID="dsMessage" 
                     
                     CellPadding="4" ForeColor="#333333" GridLines="None" PageSize="3">
                 <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                 <RowStyle BackColor="#EFF3FB" />
                 <Columns>
                     <asp:BoundField DataField="Label" />
                 </Columns>
             
                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                   <RowStyle BackColor="#EFF3FB" />
                   <SelectedRowStyle BackColor="#FF5050" />
                   <HeaderStyle BorderStyle="None" CssClass="GridViewHeader" Height="20px" 
                        Width="30px" />
                        
                    <PagerStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    <EditRowStyle BackColor="LightGray" />
                    <RowStyle CssClass="AlternativeRowStyle" />
                    <AlternatingRowStyle BackColor="White" CssClass="AlternativeRowStyle" />
                    
                 
             </asp:GridView >
             
                 <asp:ObjectDataSource ID="dsMessage" runat="server" SelectMethod="GetMessage" 
                     TypeName="DirectService"></asp:ObjectDataSource>
             <br />
             </td>    
         </tr>    
<tr><td align="center" class="GridItem" >
<asp:UpdatePanel ID="updatePanelEquipment" runat="server">
            <ContentTemplate>
           </td></tr>
                <asp:ObjectDataSource ID="odsSparepart" runat="server" 
                    SelectMethod="DataTableToIListSpareparts" TypeName="DirectService" 
                    >
                    <SelectParameters>
                        <asp:ControlParameter ControlID="txtHiddenWhereClause" Name="whereClause" 
                            PropertyName="Text" Type="String" />
                        <asp:Parameter Name="orderbyClause" Type="String" />
                    </SelectParameters>
                </asp:ObjectDataSource>
                </ContentTemplate>
                </asp:UpdatePanel>
                       
                
    <tr><td>
    <asp:TextBox ID="txtHiddenPageIndex" runat="server" Visible="False"></asp:TextBox>
    <a id="detailPosition"></a>
       <asp:TextBox ID="txtHiddenWhereClause" runat="server" Height="17px" Width="205px" Visible="False"></asp:TextBox>
       <asp:TextBox ID="txthiddenOrderbyClause" runat="server"  Width="77px" 
            Visible="False"></asp:TextBox>
              <Triggers>
                <asp:AsyncPostBackTrigger ControlID="txtHiddenWhereClause" EventName="TextChanged" />
                
            </Triggers>
            <Triggers>
            <asp:AsyncPostBackTrigger ControlID="txthiddenOrderbyClause" EventName="TextChanged" />
            </Triggers>
   <div style=" height:300px; width:auto; overflow:auto">
        	    <asp:GridView ID="grdEquipment" runat="server" AllowPaging="True" 
                    AllowSorting="True" AutoGenerateColumns="False" BorderStyle="None" 
                    CssClass="GridItem" DataKeyNames="SparepartId" DataSourceID="odsSparepart" 
                    Height="300px" OnPageIndexChanging="grdEquipment_PageIndexChanging" 
                    onrowcancelingedit="grdEquipment_RowCancelingEdit" 
                    onrowdatabound="grdEquipment_RowDataBound1" 
                    onselectedindexchanged="grdEquipment_SelectedIndexChanged" 
                    RowHeaderColumn="EquipmentId" width="720px" 
                    onrowcommand="grdEquipment_RowCommand" PageSize="8">
                    <HeaderStyle BorderStyle="None" CssClass="GridViewHeader" Height="20px" />
                    <Columns>
                        <asp:CommandField ShowSelectButton="True" />
                        
                        <%--<asp:TemplateField>
                            <ItemTemplate>
                                <a href='sparepartView.aspx?detail=false&amp;tabIndex=1&amp;informationId=<%# DataBinder.Eval(Container.DataItem, "SparepartId") %>'>
                                <img border="0" height="20" src="images/edit.png" width="20"> </img></a>
                            </ItemTemplate>
                            <ItemStyle Width="15px" />
                        </asp:TemplateField>--%>
                        
                        <asp:TemplateField HeaderText="Out">
                            <ItemTemplate>
                                <a href='sparepartOut.aspx?informationId=<%# DataBinder.Eval(Container.DataItem, "SparepartId") %>&amp;type=<%# DataBinder.Eval(Container.DataItem, "TypeLabel") %>&amp;model=<%# DataBinder.Eval(Container.DataItem, "ModelLabel") %>'>
                                <img border="0" height="15" src="images/stockout.png" width="15"> </img></a>
                            </ItemTemplate>
                            <ItemStyle Width="15px" />
                        </asp:TemplateField>
                        <asp:BoundField DataField="SparepartId" HeaderText="ID Nº">
                            <ItemStyle HorizontalAlign="Left" Width="50px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="PurchaseDate" DataFormatString="{0:MM/dd/yyyy}" 
                            HeaderText="Purchase date" HtmlEncode="False">
                            <ItemStyle HorizontalAlign="Left" Width="80px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="SystemLabel" HeaderText="System">
                            <ItemStyle HorizontalAlign="Left" Width="50px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="TypeLabel" HeaderText="Type">
                            <ItemStyle HorizontalAlign="Left" Width="100px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="ModelLabel" HeaderText="Model">
                            <ItemStyle HorizontalAlign="Left" Width="150px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Min" HeaderText="Min">
                            <ItemStyle HorizontalAlign="Right" Width="30px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Max" HeaderText="Max">
                            <ItemStyle HorizontalAlign="Right" Width="30px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="In" HeaderText="In">
                            <ItemStyle HorizontalAlign="Right" Width="30px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Out" HeaderText="Out">
                            <ItemStyle HorizontalAlign="Right" Width="30px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="Balance" HeaderText="Balance">
                            <ItemStyle HorizontalAlign="Right" Width="40px" />
                        </asp:BoundField>
                    </Columns>
                    <PagerStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    <EditRowStyle BackColor="LightGray" />
                    <RowStyle CssClass="AlternativeRowStyle" />
                    <AlternatingRowStyle BackColor="White" CssClass="AlternativeRowStyle" />
                </asp:GridView>
                
             
                
             <br />
             </td>    
         </tr>    

         <tr>
         
           
                      
								<td width="50%" class="BigLabelLeftAlign"> 
                                    <asp:Label ID="lblTotalInText" runat="server" Text="Total in :"></asp:Label><asp:Label ID="lblTotalIn" runat="server"></asp:Label> &nbsp;&nbsp;,
								<asp:Label ID="lblTotalOutText" runat="server" Text="Total out  :"></asp:Label><asp:Label ID="lblTotalOut" runat="server" ></asp:Label> &nbsp;&nbsp;,
								<asp:Label ID="lblBalanceText" runat="server" Text="Balance :"> </asp:Label><asp:Label ID="lblTotalBalance" runat="server"></asp:Label>&nbsp;&nbsp;

			
            </td>
             
         </tr>
        
                
    </table>
                     
                     </div>        
                   
                 <div class="TabbedPanelsContent" >
                        <iframe  class="FrameDimension" src="sparepartDetail.aspx?displayMode=<%=GetDisplayMode()%>&informationId=<%=txtHiddenEquipmentId.Text%>"  frameborder="0" ></iframe></div><!--This content will be included not use Iframe when using dynamique programing-->
                  
                  <div class="TabbedPanelsContent">
                        <iframe class ="FrameDimension" src="sparepartLeftInStock.aspx" frameborder="0" ></iframe>
                        </div>
                     
                 
          
    </div>
 </div>
 </div>

 </body>
</asp:Content>

<asp:Content ID="Content2" runat="server" contentplaceholderid="conSearch">
   
    &nbsp;
            <div class="AccordionPanel">
        	    <div class="AccordionPanelTab"><b class="contentcolor"><asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/images/indicator.png" />&nbsp;SPARE-PART</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </div>
        	    <div class="AccordionPanelContent">
        	    <div style="height:30px">P.O Number&nbsp; : <asp:TextBox ID="txtPONumber" 
                          runat="server" Height="17px" 
                          Width="100px"></asp:TextBox></div>
        	     <div style="height:30px"> Delivery date:
                                <asp:TextBox ID="txtPurchaseDate" runat="server" Width="80px"></asp:TextBox>
            <asp:Image ID="imgCalendar" runat="server" ImageUrl="~/images/calendar.png" />
            <cc2:CalendarExtender ID="CalendarExtender3" runat="server" TargetControlID="txtPurchaseDate" PopupButtonID="imgCalendar">
            </cc2:CalendarExtender> 
                                </div>
                                  <div style="height:30px">Warranty date:
                                <asp:TextBox ID="txtEndWarrantyDate" runat="server" Width="71px"></asp:TextBox>
            <asp:Image ID="Image1" runat="server" ImageUrl="~/images/calendar.png" />
            <cc2:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtEndWarrantyDate" PopupButtonID="Image1">
            </cc2:CalendarExtender> 
                                </div>
                 <div style="height:50px">
                        &nbsp;System :
                        <asp:UpdatePanel ID="updatePanel1" runat="server"><ContentTemplate> 
                        <asp:DropDownList ID="drlSystem" runat="server" Height="20px" 
                          Width="195px" AppendDataBoundItems="True" DataSourceID="odsSystem" 
                          DataTextField="SystemLabel" DataValueField="SystemId" AutoPostBack="True">
                                    <asp:ListItem Value="-1">--- Choose a system ---</asp:ListItem>
                        </asp:DropDownList>
                        <asp:ObjectDataSource ID="odsSystem" runat="server" 
                          SelectMethod="GetSystems" TypeName="Service.ReferenceDataService">
                        </asp:ObjectDataSource>
                        </ContentTemplate> </asp:UpdatePanel>
                                </div>
                                <div style="height:50px">
                        &nbsp;Equipment type: &nbsp;<asp:UpdatePanel ID="updatePanel2" runat="server"><ContentTemplate> <asp:DropDownList ID="drlEquipmentType" runat="server" Height="20px" 
                          Width="195px" AppendDataBoundItems="True" DataSourceID="odsEquipmentType" 
                          DataTextField="typeequipment" DataValueField="typeequipementid" AutoPostBack="True" 
                          >
                                        <asp:ListItem Value="-1">--- Choose an equipment type ---</asp:ListItem>
                                    </asp:DropDownList>
                                    <asp:ObjectDataSource ID="odsEquipmentType" runat="server" 
                          SelectMethod="GetSparepartSystemEquipmentType" TypeName="ReferenceDataDirectService">
                                        <SelectParameters>
                                            <asp:ControlParameter ControlID="drlSystem" Name="systemId" 
                                                PropertyName="SelectedValue" Type="Int32" />
                                        </SelectParameters>
                                    </asp:ObjectDataSource>
                                     </ContentTemplate> </asp:UpdatePanel>
                                </div>
                                <div style="height: 50px">
                     &nbsp;Model : &nbsp;<asp:UpdatePanel ID="updatePanel3" runat="server"><ContentTemplate><asp:DropDownList ID="drlModel" runat="server" Height="20px" 
                          Width="195px" AppendDataBoundItems="True" DataSourceID="odsEquipmentModel" 
                          DataTextField="Model" DataValueField="ModelId">
                                    <asp:ListItem Value="-1">--- Choose a Model ---</asp:ListItem>
                        </asp:DropDownList>
                        <asp:ObjectDataSource ID="odsEquipmentModel" runat="server" 
                          SelectMethod="GetModelByTypeEquipmentId" TypeName="ReferenceDataDirectService">
                            <SelectParameters>
                                <asp:ControlParameter ControlID="drlEquipmentType" Name="typeId" 
                                    PropertyName="SelectedValue" Type="Int32" />
                            </SelectParameters>
                        </asp:ObjectDataSource>
                                &nbsp; 
                        
                </ContentTemplate> </asp:UpdatePanel>
                    </div>
                  <div style="height: 50px; width: 219px;">Company: 
                                <asp:DropDownList ID="drlCompany" runat="server" Height="25px" 
                          Width="195px" AppendDataBoundItems="True" DataSourceID="odsCompany" 
                          DataTextField="SupplierName" DataValueField="SupplierId">
                                    <asp:ListItem Value="-1">--- Choose a company ---</asp:ListItem>
                                </asp:DropDownList>
                                <asp:ObjectDataSource ID="odsCompany" runat="server" 
                          SelectMethod="GetSuppliers" TypeName="Service.ReferenceDataService">
                      </asp:ObjectDataSource>
                                </div>

                 <br />
                  
                                   
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:Button  ID="btnSearch" 
                        runat="server" Height="25px" Text="Search" 
        Width="71px" BorderStyle="Dotted" onclick="btnValidate_Click" CssClass="btnexpress" 
                        EnableViewState="False" />
            
        </div></div>
 
  
</asp:Content>
